package com.leo.mapper.impl;

import com.leo.mapper.UserInfoMapper;
import com.leo.model.UserInfo;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName: UserInfoMapperImpl
 * @Description: ${description}
 * @Author: leo825
 * @Date: 2020-05-19 16:38
 * @Version: 1.0
 */
@Service
public class UserInfoMapperImpl implements UserInfoMapper {
    
    @Autowired
    SqlSessionTemplate sqlSessionTemplate;
    
    @Override
    public void insertUserInfo(UserInfo userInfo) {
        sqlSessionTemplate.insert("com.leo.mapper.UserInfoMapper.insertUserInfo", userInfo);
    }

    @Override
    public void deleteUserInfo(Integer id) {
        sqlSessionTemplate.delete("com.leo.mapper.UserInfoMapper.deleteUserInfo", id);
    }

    @Override
    public void updateUserInfo(UserInfo newUserInfo) {
        sqlSessionTemplate.update("com.leo.mapper.UserInfoMapper.updateUserInfo", newUserInfo);
    }

    @Override
    public List<UserInfo> getUserInfoList() {
        return sqlSessionTemplate.selectList("com.leo.mapper.UserInfoMapper.getUserInfoList");
    }
}
